Index: includes/specials/SpecialAllpages.php =================================================================== --- includes/specials/SpecialAllpages.php (revision 106529) +++ includes/specials/SpecialAllpages.php (working copy) @@ -70,6 +70,7 @@ $from = $request->getVal( 'from', null ); $to = $request->getVal( 'to', null ); $namespace = $request->getInt( 'namespace' ); + $hideredirects = $request->getBool( 'hideredirects', false ); $namespaces = $wgContLang->getNamespaces(); @@ -81,11 +82,11 @@ $out->addModuleStyles( 'mediawiki.special' ); if( $par !== null ) { - $this->showChunk( $namespace, $par, $to ); + $this->showChunk( $namespace, $par, $to, $hideredirects ); } elseif( $from !== null && $to == null ) { - $this->showChunk( $namespace, $from, $to ); + $this->showChunk( $namespace, $from, $to, $hideredirects ); } else { - $this->showToplevel( $namespace, $from, $to ); + $this->showToplevel( $namespace, $from, $to, $hideredirects ); } } @@ -95,8 +96,9 @@ * @param $namespace Integer: a namespace constant (default NS_MAIN). * @param $from String: dbKey we are starting listing at. * @param $to String: dbKey we are ending listing at. + * @param $hideredirects Bool: dont show redirects (default FALSE) */ - function namespaceForm( $namespace = NS_MAIN, $from = '', $to = '' ) { + function namespaceForm( $namespace = NS_MAIN, $from = '', $to = '', $hideredirects = false ) { global $wgScript; $t = $this->getTitle(); @@ -128,6 +130,12 @@ " " . Xml::namespaceSelector( $namespace, null ) . ' ' . + Xml::checkLabel( + wfMsg( 'allpages-hide-redirects' ), + 'hideredirects', + 'hideredirects', + $hideredirects + ) . ' ' . Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . " "; @@ -142,8 +150,9 @@ * @param $namespace Integer (default NS_MAIN) * @param $from String: list all pages from this name * @param $to String: list all pages to this name + * @param $hideredirects Bool: dont show redirects (default FALSE) */ - function showToplevel( $namespace = NS_MAIN, $from = '', $to = '' ) { + function showToplevel( $namespace = NS_MAIN, $from = '', $to = '', $hideredirects = false ) { $output = $this->getOutput(); # TODO: Either make this *much* faster or cache the title index points @@ -153,6 +162,10 @@ $out = ""; $where = array( 'page_namespace' => $namespace ); + if ( $hideredirects ) { + $where[ 'page_is_redirect' ] = 0; + } + $from = Title::makeTitleSafe( $namespace, $from ); $to = Title::makeTitleSafe( $namespace, $to ); $from = ( $from && $from->isLocal() ) ? $from->getDBkey() : null; @@ -221,9 +234,9 @@ // Instead, display the first section directly. if( count( $lines ) <= 2 ) { if( !empty($lines) ) { - $this->showChunk( $namespace, $from, $to ); + $this->showChunk( $namespace, $from, $to, $hideredirects ); } else { - $output->addHTML( $this->namespaceForm( $namespace, $from, $to ) ); + $output->addHTML( $this->namespaceForm( $namespace, $from, $to, $hideredirects ) ); } return; } @@ -233,10 +246,10 @@ while( count ( $lines ) > 0 ) { $inpoint = array_shift( $lines ); $outpoint = array_shift( $lines ); - $out .= $this->showline( $inpoint, $outpoint, $namespace ); + $out .= $this->showline( $inpoint, $outpoint, $namespace, $hideredirects ); } $out .= Xml::closeElement( 'table' ); - $nsForm = $this->namespaceForm( $namespace, $from, $to ); + $nsForm = $this->namespaceForm( $namespace, $from, $to, $hideredirects ); # Is there more? if( $this->including() ) { @@ -267,8 +280,9 @@ * @param $inpoint String: lower limit of pagenames * @param $outpoint String: upper limit of pagenames * @param $namespace Integer (Default NS_MAIN) + * @param $hideredirects Bool: dont show redirects (default FALSE) */ - function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { + function showline( $inpoint, $outpoint, $namespace = NS_MAIN, $hideredirects ) { global $wgContLang; $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); @@ -277,8 +291,14 @@ $outpointf = $wgContLang->truncate( $outpointf, $this->maxPageLength ); $queryparams = $namespace ? "namespace=$namespace&" : ''; + + $queryhideredirects = array(); + if ($hideredirects) { + $queryhideredirects[ 'hideredirects' ] = 1; + } + $special = $this->getTitle(); - $link = htmlspecialchars( $special->getLocalUrl( $queryparams . 'from=' . urlencode($inpoint) . '&to=' . urlencode($outpoint) ) ); + $link = htmlspecialchars( $special->getLocalUrl( $queryparams . 'from=' . urlencode($inpoint) . '&to=' . urlencode($outpoint), $queryhideredirects ) ); $out = $this->msg( 'alphaindexline' )->rawParams( "$inpointf", @@ -291,8 +311,9 @@ * @param $namespace Integer (Default NS_MAIN) * @param $from String: list all pages from this name (default FALSE) * @param $to String: list all pages to this name (default FALSE) + * @param $hideredirects Bool: dont show redirects (default FALSE) */ - function showChunk( $namespace = NS_MAIN, $from = false, $to = false ) { + function showChunk( $namespace = NS_MAIN, $from = false, $to = false, $hideredirects = false ) { global $wgContLang; $output = $this->getOutput(); @@ -316,6 +337,11 @@ 'page_namespace' => $namespace, 'page_title >= ' . $dbr->addQuotes( $fromKey ) ); + + if ( $hideredirects ) { + $conds[ 'page_is_redirect' ] = 0; + } + if( $toKey !== "" ) { $conds[] = 'page_title <= ' . $dbr->addQuotes( $toKey ); } @@ -403,7 +429,7 @@ $self = $this->getTitle(); - $nsForm = $this->namespaceForm( $namespace, $from, $to ); + $nsForm = $this->namespaceForm( $namespace, $from, $to, $hideredirects ); $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ). ' ' . @@ -419,6 +445,9 @@ if( $namespace ) $query['namespace'] = $namespace; + if( $hideredirects ) + $query['hideredirects'] = $hideredirects; + $prevLink = Linker::linkKnown( $self, $this->msg( 'prevpage', $pt )->escaped(), @@ -436,6 +465,9 @@ if( $namespace ) $query['namespace'] = $namespace; + if( $hideredirects ) + $query['hideredirects'] = $hideredirects; + $nextLink = Linker::linkKnown( $self, $this->msg( 'nextpage', $t->getText() )->escaped(), Index: includes/specials/SpecialPrefixindex.php =================================================================== --- includes/specials/SpecialPrefixindex.php (revision 106529) +++ includes/specials/SpecialPrefixindex.php (working copy) @@ -52,6 +52,7 @@ $prefix = $request->getVal( 'prefix', '' ); $ns = $request->getIntOrNull( 'namespace' ); $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN). + $hideredirects = $request->getBool( 'hideredirects', false ); $namespaces = $wgContLang->getNamespaces(); $out->setPageTitle( @@ -73,9 +74,9 @@ // Bug 27864: if transcluded, show all pages instead of the form. if ( $this->including() || $showme != '' || $ns !== null ) { - $this->showPrefixChunk( $namespace, $showme, $from ); + $this->showPrefixChunk( $namespace, $showme, $from, $hideredirects ); } else { - $out->addHTML( $this->namespacePrefixForm( $namespace, null ) ); + $out->addHTML( $this->namespacePrefixForm( $namespace, null, $hideredirects ) ); } } @@ -83,8 +84,9 @@ * HTML for the top form * @param $namespace Integer: a namespace constant (default NS_MAIN). * @param $from String: dbKey we are starting listing at. + * @param $hideredirects Bool: hide redirects (default FALSE) */ - function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { + function namespacePrefixForm( $namespace = NS_MAIN, $from = '', $hideredirects = false ) { global $wgScript; $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); @@ -107,6 +109,12 @@ " " . Xml::namespaceSelector( $namespace, null ) . ' ' . + Xml::checkLabel( + wfMsg( 'allpages-hide-redirects' ), + 'hideredirects', + 'hideredirects', + $hideredirects + ) . ' ' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . " "; @@ -121,8 +129,9 @@ * @param $namespace Integer, default NS_MAIN * @param $prefix String * @param $from String: list all pages from this name (default FALSE) + * @param $hideredirects Bool: hide redirects (default FALSE) */ - function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) { + function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null, $hideredirects = false ) { global $wgContLang; if ( $from === null ) { @@ -147,13 +156,19 @@ $dbr = wfGetDB( DB_SLAVE ); + $conds = array( + 'page_namespace' => $namespace, + 'page_title' . $dbr->buildLike( $prefixKey, $dbr->anyString() ), + 'page_title >= ' . $dbr->addQuotes( $fromKey ), + ); + + if ( $hideredirects ) { + $conds['page_is_redirect'] = 0; + } + $res = $dbr->select( 'page', array( 'page_namespace', 'page_title', 'page_is_redirect' ), - array( - 'page_namespace' => $namespace, - 'page_title' . $dbr->buildLike( $prefixKey, $dbr->anyString() ), - 'page_title >= ' . $dbr->addQuotes( $fromKey ), - ), + $conds, __METHOD__, array( 'ORDER BY' => 'page_title', @@ -202,7 +217,7 @@ if ( $this->including() ) { $out2 = ''; } else { - $nsForm = $this->namespacePrefixForm( $namespace, $prefix ); + $nsForm = $this->namespacePrefixForm( $namespace, $prefix, $hideredirects ); $self = $this->getTitle(); $out2 = Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-prefixindex-nav-table' ) ) . ' @@ -214,7 +229,8 @@ if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { $query = array( 'from' => $s->page_title, - 'prefix' => $prefix + 'prefix' => $prefix, + 'hideredirects' => $hideredirects, ); if( $namespace || ($prefix == '')) { Index: languages/messages/MessagesQqq.php =================================================================== --- languages/messages/MessagesQqq.php (revision 106529) +++ languages/messages/MessagesQqq.php (working copy) @@ -2266,6 +2266,7 @@ {{Identical|Go}}', 'allpagesprefix' => "Used for the label of the input box of [[Special:PrefixIndex]]. On this page you can either write 'Name of namespace:string from which to begin display in alphabetical order' in the top box, or you can choose a namespace in the bottom box and put 'string from which to begin display in alphabetical order' in the top box. The result will be the same.", +'allpages-hide-redirects' => 'Label for a checkbox. If the checkbox is checked redirects will not be shown in the list. Used in [[Special:PrefixIndex]] and [[Special:Allpages]].', # Special:Categories 'categories' => 'The page name of [[Special:Categories]]. Index: languages/messages/MessagesEn.php =================================================================== --- languages/messages/MessagesEn.php (revision 106529) +++ languages/messages/MessagesEn.php (working copy) @@ -2599,6 +2599,7 @@ 'allpagesbadtitle' => 'The given page title was invalid or had an inter-language or inter-wiki prefix. It may contain one or more characters which cannot be used in titles.', 'allpages-bad-ns' => '{{SITENAME}} does not have namespace "$1".', +'allpages-hide-redirects' => 'Hide redirects', # Special:Categories 'categories' => 'Categories', @@ -4630,7 +4631,7 @@ 'newuserlog-byemail' => 'password sent by e-mail', # Feedback -'feedback-bugornote' => 'If you are ready to describe a technical problem in detail please [$1 report a bug]. +'feedback-bugornote' => 'If you are ready to describe a technical problem in detail please [$1 report a bug]. Otherwise, you can use the easy form below. Your comment will be added to the page "[$3 $2]", along with your username and what browser you are using.', 'feedback-subject' => 'Subject:', 'feedback-message' => 'Message:',